<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of minDistancePoints</title>
  <meta name="keywords" content="minDistancePoints">
  <meta name="description" content="MINDISTANCEPOINTS compute minimal distance between several points">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../../index.html">Home</a> &gt;  <a href="#">imael</a> &gt; <a href="#">geom2d</a> &gt; minDistancePoints.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../../index.html"><img alt="<" border="0" src="../../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for .\imael\geom2d&nbsp;<img alt=">" border="0" src="../../right.png"></a></td></tr></table>-->

<h1>minDistancePoints
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>MINDISTANCEPOINTS compute minimal distance between several points</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>function varargout = minDistancePoints(p1, varargin) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre class="comment">MINDISTANCEPOINTS compute minimal distance between several points

   DIST = minDistancePoints(PTS)
   Returns the minimum distance between all couple of points in PTS. PTS is
   an array of [NxND] values, N being the number of points and ND the
   dimension of the points.

   DIST = minDistancePoints(PTS1, PTS2)
   Computes for each point in PTS1 the minimal distance to every point of
   PTS2. PTS1 and PTS2 are [NxD] arrays, where N is the number of points,
   and D is the dimension. Dimension must be the same for both arrays, but
   number of points can be different.
   The result is an array the same length as PTS1.


   DIST = minDistancePoints(..., NORM)
   Uses a user-specified norm. NORM=2 means euclidean norm (the default), 
   NORM=1 is the Manhattan (or &quot;taxi-driver&quot;) distance.
   Increasing NORM growing up reduces the minimal distance, with a limit
   to the biggest coordinate difference among dimensions. 
   

   [DIST I J] = minDistancePoints(PTS)
   Returns indices I and J of the 2 points which are the closest. DIST
   verifies relation:
   DIST = distancePoints(PTS(I,:), PTS(J,:));

   [DIST J] = minDistancePoints(PTS1, PTS2, ...)
   Also returns the indices of points which are the closest. J has the
   same size as DIST. It verifies relation : 
   DIST(I) = distancePoints(PTS1(I,:), PTS2(J,:));


   Examples:
   % minimal distance between random planar points
       points = rand(20,2)*100;
       minDist = minDistancePoints(points);

   % minimal distance between random space points
       points = rand(30,3)*100;
       [minDist ind1 ind2] = minDistancePoints(points);
       minDist
       distancePoints(points(ind1, :), points(ind2, :))
   % results should be the same

   % minimal distance between 2 sets of points
       points1 = rand(30,2)*100;
       points2 = rand(30,2)*100;
       [minDists inds] = minDistancePoints(points1, points2);
       minDists(10)
       distancePoints(points1(10, :), points2(inds(10), :))
   % results should be the same
   
   See Also
   <a href="points2d.html" class="code" title="function points2d">points2d</a>, <a href="distancePoints.html" class="code" title="function dist = distancePoints(p1, p2, varargin)">distancePoints</a>

   ---------

   author : David Legland
   INRA - TPV URPOI - BIA IMASTE
   created the 15/06/2004.</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="cart2geod.html" class="code" title="function point = cart2geod(src, curve)">cart2geod</a>	CART2GEOD convert cartesian coordinates to geodesic coord.</li><li><a href="polynomialCurveSetFit.html" class="code" title="function varargout = polynomialCurveSetFit(seg, varargin)">polynomialCurveSetFit</a>	POLYNOMIALCURVESETFIT fit a set of polynomial curves to a segmented image</li></ul>
<!-- crossreference -->



<hr><address>Generated on Fri 05-Feb-2010 11:20:41 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address>
</body>
</html>